#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

int main()
{
    int pid = fork();
    if(pid > 0)
    {
        int i = 10;
        while(i--)
        {
            printf("我是父进程:%d\n",getpid());
            sleep(1);
        }
    }
    else 
    {
        int i = 10;
        while(i--)
        {
            printf("我是子进程:%d\n",getpid());
            sleep(1);
        }
    }
    return 0;
}
